<%--
 *  File:    DistributortenderReport.jsp
 *  @Author: JackYin
 *  Date:    2011.1.11

 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page import="java.text.*" %>
<%@ page contentType = "text/html;charset=UTF-8" %>
<%
Category cat = Category.getInstance("jsp.DistributortenderReport");
String strModuleName = "COM";
String privilegeCode = "SFE01120";
String strTableName = "v_disreport";
String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc"%>

<html>
<head>
<title>DistributortenderReport</title>

<PageFlow:CheckPageFlow pageName="p_disreport"/>
	<%
		Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
		if(searchresults == null) searchresults = new Vector();
		
		HashMap userinfo = (HashMap)session.getAttribute("userinfo");
		
		
		java.text.DateFormat format=new java.text.SimpleDateFormat("yyyy-MM-dd");
		
	 	
		String sysdates=format.format(new Date());
	    //Date sysdate = format.parse(ss.toString());
	    
	    String dateFormat = (String)session.getAttribute("dateformat");
		if(dateFormat==null)dateFormat = "yyyy-MM-dd";
	
	%>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>
<iframe name="reloadHandler" style="display:none" ></iframe>


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet"
	href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css"
	type="text/css">
<script language="JavaScript"
	src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript"
	src="<%=contextPath%>/js/SummaryDivision.js"></script>
<%@ include file ="/inc/NewCalendar.inc" %>	
<script language="JavaScript">
  
function page_summary(actionvalue,orderbyname)
{
 //if(!checkDate()) return;
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "DistributortenderReport.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}


function page_popBusinessarea()
{
  if (typeof popwindow != 'undefined') popwindow.close();
  popwindow = window.open("<%=contextPath%>/masterdata/ogm/zylstdbusinessareapop.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>","newwindow", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
	
}

function setContact(id,type,name){
	document.cform.disregionid.value=id;
	document.cform.areaname.value=name;
	//setconfigname();
}


function page_popProd()
{
  if (typeof popwindow != 'undefined') popwindow.close();
  popwindow = window.open("<%=contextPath%>/devlop/distributortender/DistributortenderProdSelect.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode %>&flag=1","newwindow", "height=300, width=800,top=100,left=100,toolbar=n0, menubar=no, scrollbars=yes, resizable=no, location=no, status=no");
	
}

function setProd(code,name,id){
	document.cform.prodid.value=id;
	document.cform.prodname.value=name;
	//document.cform.prodcode.value=code;
}


function setconfigname(){

	var disregionid = cform.disregionid.value;
  	var datahandler = new  DataHandler() ;
  	datahandler.add_params("disregionid" , disregionid,"integer") ;
  	
  	datahandler.getResultFromVector("configs" ,"tenderconfigname" ,"tenderconfigid" ,"document.cform.tenderconfigid");

  	datahandler.add_job("j_disconfig") ;
    datahandler.runDataHandler ();
}




function page_export() {
	var disregionid = document.cform.disregionid.value;//提报省份ID
	var tenderconfigid = document.cform.tenderconfigid.value;//招标类型ID
	var dictionaryid=document.cform.dictionaryid.value;//药品目录属性
	var prodid = document.cform.prodid.value;//竞标产品
    var sysdates=document.cform.sysdates.value;//系统时间
    var startdate=document.cform.startdate.value;//开始时间
    var enddate=document.cform.enddate.value;//结束时间

    

	var url = "<%=reportURL%>/servlet/ExcecuteReport/disreport.sox?__format=xlsx&__folder=/ovalreport&disregionid="+disregionid+"&tenderconfigid="+tenderconfigid+"&dictionaryid="+dictionaryid+"&prodid="+prodid+"&sysdates="+sysdates+"&startdate="+startdate+"&enddate="+enddate;
	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
	popwindow = window.open(url, "n1window", strstatus);
	                
}


</script>
</head>
<body>

<% //--------------------------------------  page location --%>
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_disreport">
	<input type="hidden" name="actionname">
	<custom:hidden property="tempstatus"></custom:hidden>
	<input type="hidden" name="sysdates" value="<%= sysdates %>">
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr>
    <td>
      <table width="800" border="0" cellspacing="0" onkeydown="if(event.keyCode==13) page_summary('search');" >
      <tr>
      
			<td><%=label.getLabelName("L_Report1") +label.getLabelName("L_Province") +label.getLabelName("L_Colon")%></td>
			<td>
				<custom:hidden property="disregionid"/>
	           	<custom:text property="areaname"/>
	           	<a onclick="page_popBusinessarea();"><custom:button type="3" value="*"/></a>
			</td>
			
			<td><%=label.getLabelName("L_TenderType")+ label.getLabelName("L_Colon")%></td>
			<td><custom:select  property="tenderconfigid" optionsName="configs" optionValueKey="tenderconfigid" optionInnerTextKey="tenderconfigname"  
			 	defaultValueCost="" defaultValue="--------------"/> 
			</td>
      </tr>
		<tr>
			<td><%=label.getLabelName("L_Drugs")+ label.getLabelName("L_Colon")%></td>
			<td>
					<custom:select  property="dictionaryid" optionsName="dictionarys" 
				    optionValueKey="dictionaryid" optionInnerTextKey="valuename"   defaultValueCost="" defaultValue="--------------"/> 
         	</td>
			
			
			<td><%=label.getLabelName("L_Prodname") +label.getLabelName("L_Colon")%></td>
			<td>
				<custom:hidden property="prodid" />
	           	<custom:text property="prodname" />
	           	<a onclick="page_popProd();"><custom:button type="3" value="*"/></a>
         </td>
				
		</tr>
		<tr>
  			 <%
                SimpleDateFormat formatter1 = new SimpleDateFormat ("yyyy-MM-dd");
                String str_date_end=formatter1.format(new Date());
                
              %>

			<td><%= label.getLabelName("L_TimePeriod") + label.getLabelName("L_Colon") %></td>
		    <td>
	                <custom:text property="startdate"  dataType="date"  module="IMG" size="15" />
	              <a onclick="javascript:c.show(this,'cform.startdate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
	              --
	              <%if(pageContext.getAttribute("enddate")==null){%>
				  <custom:text property="enddate" dataType="date" dataFormatName="dateformat" module="IMG" size="15"/>
				  <%}else{%>
				  <custom:text property="enddate"  dataType="date" dataFormatName="dateformat"  module="IMG"  size="15"/>
				  <%}%>
	              <a onclick="javascript:c.show(this,'cform.enddate','yyyy-MM-dd');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
	            &nbsp;&nbsp;&nbsp;<a href="javascript:page_summary('search')"><img src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a>
	         </td>
				
		</tr>		
	  </table>
    </td>
  </tr>
  

		
           <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
         <tr  class="deepblue-left"> 
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','areaname')"><%= label.getLabelName("L_Report1") +label.getLabelName("L_Province")%></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','tenderconfigname')"><%= label.getLabelName("L_TenderType") %></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','valuename')"><%= label.getLabelName("L_Drugs") %></a></td>
            <td width="16%" class="title_center"><a href="javascript:page_summary('orderby','prdn')"><%= label.getLabelName("L_Prodname") %></a></td>
            <!-- 
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','regionname')"><%= label.getLabelName("L_Distribution")+ label.getLabelName("L_Province")%></a></td>
             -->
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','distributortendername')"><%= label.getLabelName("L_DistributortenderName") %></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','tenderdate')"><%= label.getLabelName("L_TenderTime") %></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','tenderprice')"><%= label.getLabelName("L_TenderPrice") %></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','listprice')"><%= label.getLabelName("L_Listprice") %></a></td>
            <td width="7%" class="title_center"><a href="javascript:page_summary('orderby','rate')"><%= label.getLabelName("L_Rate") %></a></td>
            <td width="7%" class="title_center"><a href="javascript:page_summary('orderby','comments')"><%= label.getLabelName("L_Comments") %></a></td>
	
         </tr>
         <%
             int i = 0;
             String strClassType = new String(); 
             Integer nDrate = null;
             boolean bHasChecked = false;
          %>
          <logic:iterate id="summary" collection="<%= searchresults %>">                      
         <%
            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
            if(summaryMap == null) summaryMap = new HashMap();
            String strIsChecked = new String("");
            
            if(i%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
            if(!bHasChecked)
            {
              strIsChecked = "Checked";
              bHasChecked = true;
              //nDrate = (Integer)(summaryMap.get("rate"));
            }
              
            i++;     
          %>
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>">
            <td><custom:write property="areaname" name="summary" nbsp="true"/></td>
            <td><custom:write property="tenderconfigname" name="summary" nbsp="true"/></td>
            <td><custom:write property="valuename" name="summary" nbsp="true"/></td>
            <td><custom:write property="prdn" name="summary" nbsp="true"/></td>
            <!-- 
            <td><custom:write property="regionname" name="summary" nbsp="true"/></td>
             -->
            <td><custom:write property="distributortendername" name="summary" nbsp="true"/></td>
            <td><custom:write property="tenderdate" name="summary" nbsp="true"/></td> 
			<td><custom:write property="tenderprice" name="summary" nbsp="true"/></td>
			<td><custom:write property="listprice" name="summary" nbsp="true"/></td>
			<td><custom:write property="rate" name="summary" nbsp="true"/>%</td>
			<td><custom:write property="comments" name="summary" nbsp="true"/></td>
          </tr>
          </logic:iterate>
          <input type="hidden" name="numrows" value="<%=searchresults.size()%>"/>
      <% //--------------------------------------  flipping page --%>
      <%@ include file="/inc/SummaryAction.inc" %>
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
        <tr>
        		
              <td class="td_center">
              	<%if(searchresults.size()>0) {%>
				<a onclick="page_export();"><custom:button type="1" label="L_Execcd" imgsrc="CreatSubDept.gif" border="0" /></a>
				<%}else{ %>
				&nbsp;
				<%} %>
              </td>
            </tr>
      </table>
    </td>
  </tr>
  </form>
</table>
</body>
</html>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     